package st.magnuzon.book.client.custom.ui;

import st.magnuzon.book.client.managed.ui.ApplicationListPlaceRenderer;
import st.magnuzon.book.client.scaffold.place.ProxyListPlace;
import st.magnuzon.book.client.scaffold.ui.LoginWidget;

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasConstrainedValue;
import com.google.gwt.user.client.ui.NotificationMole;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.ValuePicker;
import com.google.gwt.user.client.ui.Widget;

public class CustomView extends Composite {

	private static CustomViewUiBinder uiBinder = GWT.create(CustomViewUiBinder.class);

    @UiField LoginWidget loginWidget;
    @UiField ConsoleLinkWidget consoleLinkWidget;
	@UiField SimplePanel details;
	@UiField DivElement error;
	@UiField SimplePanel master;
	@UiField NotificationMole mole;
	@UiField(provided = true)
	ValuePicker<ProxyListPlace> placesBox = new ValuePicker<ProxyListPlace>(new ApplicationListPlaceRenderer());
	
	interface CustomViewUiBinder extends UiBinder<Widget, CustomView> {
	}

	public CustomView() {
		initWidget(uiBinder.createAndBindUi(this));
		loginWidget.setVisible(false);
	}
	
	/**
	 * @return the panel to hold the details
	 */
	public SimplePanel getDetailsPanel() {
		return details;
	}

	/**
     * @return the login widget
     */
    public LoginWidget getLoginWidget() {
        return loginWidget;
    }
    
    /**
     * @return the login widget
     */
    public ConsoleLinkWidget getConsoleLinkWidget() {
        return consoleLinkWidget;
    }
    
	/**
	 * @return the panel to hold the master list
	 */
	public SimplePanel getMasterPanel() {
		return master;
	}

	/**
	 * @return the notification mole for loading feedback
	 */
	public NotificationMole getMole() {
		return mole;
	}

	/**
	 * @return the navigator
	 */
	public HasConstrainedValue<ProxyListPlace> getPlacesBox() {
		return placesBox;
	}
	
	/**
	 * @param string
	 */
	public void setError(String string) {
		error.setInnerText(string);
	}
}
